package com.neibu.hw5.demo05;

import com.neibu.hw4.Student;

import java.util.function.Function;

/**
 * @author bin
 * @date 2025 - 04 -02
 **/
public class MainTest {
    public static void main(String[] args) {
        String stu = "张三,18";
        Function<String, Student> function = (s) -> {
            String[] split = s.split(",");
            Student student = new Student();
            student.setName(split[0]);
            student.setAge(Integer.parseInt(split[1]));
            return student;
        };

        Student apply = function.apply(stu);
        System.out.println(apply);
    }
}
